package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /*
    *根据菜品id查询对应的套餐id
    * */

    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    @Insert("insert into setmeal_dish(setmeal_id, dish_id, name, price, copies) " +
            "VALUES (#{setmealId},#{dishId},#{name},#{price},#{copies})")
    void add(SetmealDish setmealDish);

    @Delete("delete from setmeal_dish where setmeal_id=#{setmealId}")
    void deleteBySetmealId(Long setmealId);

    /*
    * 修改套餐菜品关联表
    * */
    void insertBatch(List<SetmealDish> setmealDishes);


}
